package com.shop.pandian.framework.base.dao;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import com.shop.pandian.framework.base.page.BaseQuery;
import com.shop.pandian.framework.base.page.Page;
import com.shop.pandian.framework.base.page.PageRequest;

public interface EntityDAO<E, PK extends Serializable> {

	public List<E> find(String hql, Map<String, Object> values);

	public List<E> findByHql(String hql, Object[] values);

	public List<E> findAllBy(String[] propertyNames, Object[] values);

	Page pageQuery(String sql, PageRequest pageRequest);

	Page pageQuery(String sql, PageRequest pageRequest, Map customFilters);

	Page pageQuery(String sql, String countQuery, PageRequest pageRequest);

	Page pageQuery(String sql, String countQuery, PageRequest pageRequest, Map customFilters);

	void save(E entity);

	List<E> findAll();

	E getById(PK id);

	void delete(Object entity);

	void delete(Serializable entity);

	void deleteById(PK id);

	void update(E entity);

	void saveOrUpdate(E entity);

	void refresh(Object entity);

	void deleteAll(Collection entities);

	Page findPage(BaseQuery baseQuery);

}
